#! /bin/bash 
# Shell程序必须以上面一行作为行开头
function hello(){
	printf "hello, world"!
}
#this function is print hello world

function tell_who_i_am(){
        whoami
}
#this function is print local username 


function which_distro_do_i_use(){
        grep ^NAME /etc/os-release
}
#this function is print system name


function view_my_cpu_arch(){
        uname -m #显示计算机硬件架构名称

}
#this function is print cpu arch

function show_first_scsi_disk_size(){
         lsblk -l | \grep disk | \grep '^sda' | awk '{print $4}'
}
#this function is print local first disk size


function show_main_memory_size_in_megabytes(){
        free -m | grep "Mem:" | awk '{print $2}'
}
#this function is print main memory size

#简单的if语句
function if_use(){
	echo -n "DO YOU WANT TO CONTINUE? Y OR N"
	read ANSWER
	if [ $ANSWER == N -o $ANSWER == n ];then
		echo "THIS IS A TEST"
	else
		echo "YOU WANT TO CONTINUE!"
	fi
}

function until_use(){
	echo -n "please input:"
	read EXIT
	until [$EXIT == "exit"]
	do
		echo $EXIT
	done
		echo "OK!"
}

#these order is use for test lab1's funtion
#hello
#tell_who_i_am
#which_distro_do_i_use
#view_my_cpu_arch
#show_first_scsi_disk_size
#show_main_memory_size_in_megabytes
#if_use
#until_use
